package com.example.servlet;


import com.example.pojo.Customer;
import com.example.service.ICustomerService;
import com.example.service.impl.ICustomerServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/addPage")
public class AddPageServlet  extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ICustomerService customerService = new ICustomerServiceImpl();
        List<Customer> list =  customerService.finAll();
        req.setAttribute("list",list);

        // 3.
        req.getRequestDispatcher("/WEB-INF/jsp/customer/add.jsp").forward(req,resp);
    }
}
